import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by user on 26.01.14.
 */
public class streamMain
{
    public static void main(String[] args){
        List<String> all = new ArrayList<String>();
        myThread myThread = new myThread(all);
        myThread2 myThread1 = new myThread2(all);
        Thread tr1 = new Thread(myThread);
        Thread tr2 = new Thread(myThread1);
        tr1.start();
        tr2.start();
        System.out.println("Для остановки работы потоков введите слово stop");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if(s.equals("stop")){
            myThread.setFlag(false);
            myThread1.setFlag(false);
        }

    }
}
